package cn.ghf.basic.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //拦截地址
                .addPathPatterns("/**")
                //放行地址
                .excludePathPatterns("/login/**")  //登录
                .excludePathPatterns("/user/register/phone/**")  //用户注册
                .excludePathPatterns("/shop/settlement/**")  //商店注册
                .excludePathPatterns("/verifycode/**")  //验证码
                .excludePathPatterns("/fastDfs") //文件上传（分布式文件存储系统）
                .excludePathPatterns("/notify"); //支付宝支付
    }
}